<template>
  <div class="EmergencyList">
    <div class="flex location-wrap">
      <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EDManagement' }">应急处置</el-breadcrumb-item>
        <el-breadcrumb-item>应急日报</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="box">
      <!-- 列表筛选 -->
      <filterTitle @query="query" @reset="reset" :form="form" labelWidth="140px" :formData="formData"
        @node-click="deptChoose">
        <!-- <el-form slot="filter" class="form" ref="form" :model="form" inline size="small" label-width="140px">
          <el-form-item :label="item.label + '：'" v-for="(item, index) in formData" :key="index" :prop="item.id">
            <LsdForm :compData="item" :form="form" @node-click="deptChoose(arguments, item)" />
          </el-form-item>
        </el-form> -->
      </filterTitle>
      <!-- 列表表格 -->
      <LsdTable slot="gjxm" :paginationAtrrs="paginationAtrrs" :compRef="table.compRef" ref="gjxm"
        @pageChange="handleSizeChange" :columns="table.columns" :title="table.title" :actions="table.actions"
        :tableData="table.tableData" :tableAttr="table.tableAttr" :isShowPage="table.isShowPage"
        :isSelectFlag="table.isSelectFlag" :isSequenceFlag="table.isSequenceFlag" @onActionClick="onActionClick" />
    </div>
    <!-- 弹窗信息 -->
    <LsdDialog :dialogConfig="dialogConfig" @handleBtn="handleBtn" @close="close">
      <LsdDialogTitle slot="dialog" :titleConfig="titleConfig" :activeNames="activeNames">
        <DialogForm ref="formComponent" slot="slot1" :formConfig="formConfig" @changeEvent="handleChange" />
        <DialogForm ref="formComponent1" slot="slot2" :formConfig="formConfig1" />
        <LsdTable slot="slot2" :compRef="tables.compRef" :autoHeight="tables.autoHeight" ref="gjxm"
          :columns="tables.columns" :title="tables.title" :tableData="tables.tableData" :tableAttr="tables.tableAttr"
          :isShowPage="tables.isShowPage" :isSelectFlag="tables.isSelectFlag" :isSequenceFlag="tables.isSequenceFlag" />
        <DialogForm ref="formComponent2" slot="slot2" :formConfig="formConfig2" />
        <LsdTable slot="slot3" :compRef="UnitInput.compRef" :autoHeight="UnitInput.autoHeight" ref="gjxm"
          :columns="UnitInput.columns" :title="UnitInput.title" :tableData="UnitInput.tableData"
          :tableAttr="UnitInput.tableAttr" :isShowPage="UnitInput.isShowPage" :isSelectFlag="UnitInput.isSelectFlag"
          :isSequenceFlag="UnitInput.isSequenceFlag" />
        <LsdTable slot="slot4" :compRef="WeatherForecast.compRef" :autoHeight="WeatherForecast.autoHeight" ref="gjxm"
          :columns="WeatherForecast.columns" :title="WeatherForecast.title" :tableData="WeatherForecast.tableData"
          :tableAttr="WeatherForecast.tableAttr" :isShowPage="WeatherForecast.isShowPage"
          :isSelectFlag="WeatherForecast.isSelectFlag" :isSequenceFlag="WeatherForecast.isSequenceFlag" />
        <DialogForm ref="formComponent3" slot="slot5" :formConfig="formConfig3" />
      </LsdDialogTitle>
    </LsdDialog>
  </div>
</template>

<script>
import { listPageEmergencyDaily, getDailyName, selectEmergencyDaily, getOrgDepartmentLis, SaveEmergencyDaily, submitEmergencyDaily, deleteByIdEmergencyDaily, getByIdEmergencyDaily, UpdByIdEmergencyDaily, selectResponse, getByAreaNameAndTimeCode } from "@/api/EmergencyDisposal/yjrb.js";
import {
  getinfo
} from "@/api/EmergencyDisposal/xymld";
// import { getUnitTreeApi } from "@/api/EarlyWarningManagement/yjrb";
import { tables, UnitInput, WeatherForecast } from "./config";
import { getDictByGroupEmergency } from "@/api/common.js";
import { showTime } from "@/lib";
export default {
  name: "EmergencyList",
  components: {},
  data() {
    return {
      tables: tables, // 应急日报表格配置
      UnitInput: UnitInput, // 各单位投入情况表格配置
      WeatherForecast: WeatherForecast, // 天气预报情况表格配置
      type: 0,
      one: "",
      // 筛选信息
      formData: [
        {
          elType: "input",
          id: "sourceInfoId",
          label: "响应命令单",
          attrs: {
            value: "",
            clearable: true,
            size: "small"

          }
        },
        {
          elType: "input",
          id: "dailyName",
          label: "日报名称",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        // {
        //   elType: "select",
        //   id: "approvalDeptId",
        //   label: "发布单位及部门",
        //   attrs: {
        //     value: "",
        //     size: "small",
        //     clearable: true,
        //     filterable: true,
        //     "collapse-tags": true
        //   },
        //   options: []
        // },
        {
          elType: "selectTree",
          id: "creatorUnit",
          name: "creatorUnit",
          label: "发布单位及部门",
          attrs: {
            value: "",
            clearable: true,
            "collapse-tags": true
          },
          options: {
            attrs: {
              value: ""
            }
          },
          treeData: {
            attrs: {
              data: []
            },
            props: {
              children: "children",
              label: "orgName",
              value: "id"
            }
          }
        },
        // {
        //   elType: "dateTimePicker",
        //   id: "createTime",
        //   label: "上报时间",
        //   attrs: {
        //     value: "",
        //     size: "small",
        //     clearable: true,
        //     type: "datetime",
        //     "value-format": "yyyy-MM-dd HH:mm:ss"
        //   }
        // },
        {
          elType: "dateTimePicker",
          id: "createTime",
          label: "上报时间",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            type: "datetimerange",
            "start-placeholder": "开始日期",
            "end-placeholder": "结束日期",
            "value-format": "yyyy-MM-dd HH:mm:ss"
          }
        },
        {
          elType: "select",
          id: "eventCode",
          label: "事件类别",
          dic: "dic_sjlb",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "select",
          id: "responseLvCode",
          label: "响应级别",
          dic: "dic_xyjb",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "input",
          id: "effectRange",
          label: "影响范围",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          }
        },
        {
          elType: "dateTimePicker",
          id: "effectStartTime",
          label: "影响时间",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            type: "datetimerange",
            "start-placeholder": "开始日期",
            "end-placeholder": "结束日期",
            "value-format": "yyyy-MM-dd HH:mm:ss"
          }
        }
      ],
      // 表格信息
      table: {
        isSelectFlag: false,
        compRef: "gjxm",
        isSequenceFlag: true,
        isShowPage: true,
        resetFlag: true,
        loading: false,
        title: "应急日报列表",
        actions: [
          {
            id: "dialogVisible",
            text: "新增",
            type: "primary",
            btnAttr: { size: "small" }
          }
        ],
        tableData: [],
        columns: [
          {
            prop: "dailyName",
            label: "日报名称",
            align: "letf",
            "min-width": "200px",
            render: (h, { row }) => {
              return (
                <div>
                  {
                    <span
                      style='width: 100%;' class='commonTableStyle'
                      {...{
                        on: {
                          click: () => {
                            this.detailList(row);
                          }
                        }
                      }}
                    >
                      {row.sourceInfo}{row.dailyName}
                    </span>
                  }
                </div>
              );
            }
          },
          {
            prop: "eventName",
            label: "事件类别",
            align: "center"
          },
          {
            prop: "responseLvName",
            label: "响应级别",
            align: "center"
          },
          {
            prop: "effectRange",
            label: "影响范围",
            align: "center"
          },
          {
            prop: "effectTime",
            label: "影响时间",
            align: "left",
            "min-width": "120px"
          },
          // {
          //   prop: "sourceInfoId",
          //   label: "信息来源",
          //   align: "center"
          // },

          {
            prop: "creatorUnit",
            label: "发布单位及部门",
            align: "left",
            "min-width": "100px"
          },
          {
            prop: "createTime",
            label: "上报时间",
            align: "center",
            "min-width": "130px"
          },
          {
            prop: "creator",
            label: "上报人",
            align: "center"
          },
          {
            prop: "sourceInfo",
            label: "响应命令单",
            align: "letf",
            "min-width": "230px",
            render: (h, { row }) => {
              return (
                <div>
                  {
                    <span
                      style='width: 100%;' class='commonTableStyle'
                      {...{
                        on: {
                          click: () => {
                            this.detailLists(row);
                          }
                        }
                      }}
                    >
                      {row.sourceInfo}
                    </span>
                  }
                </div>
              );
            }
          },
          {
            prop: "state",
            label: "状态",
            align: "center",
            "min-width": "100px",
            formatter: (row, column, cellValue, index) => {
              if (cellValue === "0") {
                return "编辑中";
              } else if (cellValue === "1") {
                return "已上报";
              }
            }
          },
          {
            prop: "cz",
            label: "操作",
            align: "center",
            fixed: "right",
            "min-width": "80px",
            render: (h, { row }) => {
              return (
                <div>
                  {
                    <span
                      style='color:#3561fd;cursor:pointer;margin:0 10px'
                      {...{
                        on: {
                          click: () => {
                            this.HanEdit(row);
                          }
                        }
                      }}
                    >
                      {row.state === "0" ? "编辑" : ""}
                    </span>
                  }
                  {
                    <span
                      style='color:#3561fd;cursor:pointer;'
                      {...{
                        on: {
                          click: () => {
                            this.detailForm(row);
                          }
                        }
                      }}
                    >
                      {row.state === "0" ? "删除" : ""}
                    </span>
                  }
                </div>
              );
            }
          }
        ],
        tableAttr: {
          // "max-height": "430px",
          // height: "430px",
          stripe: false,
          border: true,
          fit: true,
          tripe: true,
          "show-header": true,
          "highlight-current-row": true,
          "cell-style": {
            "font-size": "16px"
          },
          "header-cell-style": {
            "text-align": "center",
            "background-color": "#B1C8F9",
            border: "1px solid #ccc",
            "font-size": "16px"
          }
        }
      },
      paginationAtrrs: {
        total: 0,
        "background": true,
        layout: "prev, pager, next",
        "current-page": 1,
        "page-size": 10
      },
      activeNames: ["1", "2", "3", "4", "5"],
      form: {},
      pageNum: 1,
      pageSize: 10,
      multipleSelection: [],
      // 弹窗信息
      dialogConfig: {
        title: "应急日报",
        isShow: false,
        btnList: [
          {
            name: "提交",
            id: "BSubmit", // 事件名
            type: "primary",
            size: "small"
          },
          {
            name: "保存",
            id: "submitForm",
            size: "small"
          },
          {
            name: "取消",
            id: "Qxiao",
            size: "small"
          }
        ]
      },
      // 折叠面板信息
      titleConfig: [
        {
          title: "信息来源",
          name: "1",
          slot: "slot1"
        },
        {
          title: "应急日报",
          name: "2",
          slot: "slot2"
        },
        {
          title: "各单位投入情况",
          name: "3",
          slot: "slot3"
        },
        {
          title: "天气预报情况",
          name: "4",
          slot: "slot4"
        },
        {
          title: "填报信息",
          name: "5",
          slot: "slot5"
        }
      ],
      formConfig: {
        formData: [
          {
            type: "select",
            label: "响应命令单",
            prop: "sourceInfoId",
            class: "sjgy",
            lableWidth: "140px",
            option: []
          }
        ],
        rules: {
          sourceInfoId: [
            { required: true, message: "请选择响应命令单", trigger: "change" }
          ]
        }
      },
      formConfig1: {
        formData: [
          {
            type: "input",
            label: "日报名称",
            prop: "dailyName",
            isDisabled: true,
            class: "sjgy",
            lableWidth: "140px"

          },
          {
            type: "textarea",
            label: "总体情况",
            prop: "overAll",
            class: "sjgy",
            lableWidth: "140px"

          }
        ],
        rules: {
          overAll: [
            { required: true, message: "请输入总体情况", trigger: "change" }
          ]
        }
      },
      formConfig2: {
        formData: [
          {
            type: "textarea",
            label: "应急处置情况",
            prop: "emergencySituation",
            class: "sjgy",
            lableWidth: "140px"

          }
        ],
        rules: {
          emergencySituation: [
            { required: true, message: "请输入应急处置情况", trigger: "change" }
          ]
        }
      },
      formConfig3: {
        formData: [
          {
            type: "input",
            label: "上报人",
            prop: "creator",
            name: "creator",
            isDisabled: true,
            class: "third",
            lableWidth: "140px"
          },
          {
            type: "input",
            label: "单位及部门",
            class: "third",
            isDisabled: true,
            prop: "creatorUnit",
            lableWidth: "140px"
          },
          {
            type: "input",
            label: "上报时间",
            class: "third",
            isDisabled: true,
            prop: "createTime",
            lableWidth: "140px"
          }
        ]
      },
      fid: "",
      FilledBy: {},
      dailyName: "",
      orgId: ""

    };
  },
  watch: {
    "$route.query.state": {
      handler() {
        this.list();
        // this.eventStateId = this.$route.query.eventState
        // // this.getDetail();
        // console.log(this.eventStateId)
        // // 深度监听，同时也可监听到param参数变化
      },
      deep: true
    }
  },
  created() {
    this.getUnitTree();
    this.list();
    // this.getInputVals();
    this.getInputVal();
    this.getListEmergencyDaily();
    const FilledBy = {
      creator: JSON.parse(sessionStorage.getItem("account")).realName,
      creatorId: JSON.parse(sessionStorage.getItem("account")).id,
      deptId: JSON.parse(sessionStorage.getItem("org")).orgCode,
      // creatorUnit: JSON.parse(sessionStorage.getItem("org")).orgName,
      creatorUnit: sessionStorage.getItem("dwbmName"),
      createTime: showTime(new Date())
    };
    this.FilledBy = FilledBy;
  },

  methods: {
    // 树状选择
    deptChoose(val, item) {
      this.$set(this.form, "creatorUnit", val[0].orgName);
      this.orgId = val[0].id;
      // this.$set(this.form, "infoSource", val[0].orgCode)
    },
    // 树状接口
    getUnitTree() {
      getOrgDepartmentLis({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
        this.formData[2].treeData.attrs.data = res;
      });
    },
    // 关联响应命令单详情
    detailLists(id) {
      this.$router.push({
        name: "EmergencyResponseinfo",
        query: { id: id.sourceInfoId }
      });
    },
    // async getListEmergencyDaily() {
    //   const res = await selectResponse({});
    //   let options = [];
    //   options = res.data.map(item => {
    //     return {
    //       label: item.responseName,
    //       value: item.id,
    //       ...item
    //     };
    //   });
    //   this.formData[0].options = options;
    // },
    async getListEmergencyDaily() {
      const res = await selectResponse({ unitId: JSON.parse(sessionStorage.getItem("org")).orgId });
      let options = [];
      options = res.map(item => {
        return {
          label: item.responseName,
          value: item.id,
          ...item
        };
      });
      this.formConfig.formData[0].option = options;
      this.formData[0].options = options;
    },
    // 重置
    reset() {
      this.form = this.$options.data().form;
      this.$refs.gjxm.paginationAtrrsInner["current-page"] = 1;
      this.list();
    },
    // 检索
    async query(val) {
      let parmas = {};
      if (val) {
        parmas = val;
      } else {
        parmas = {
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          state: this.$route.query.state,
          effectRange: this.form.effectRange,
          dailyName: this.form.dailyName,
          // createTime: this.form.createTime ? this.form.createTime.substring(0, 10) : "",
          createTimeStart: this.form.createTime ? this.form.createTime[0] : "",
          createTimeEnd: this.form.createTime ? this.form.createTime[1] : "",
          responseLvCode: this.form.responseLvCode,
          effectTimeStart: this.form.effectStartTime ? this.form.effectStartTime[0] : "", // 开始时间,
          effectTimeEnd: this.form.effectStartTime ? this.form.effectStartTime[1] : "",
          sourceInfo: this.form.sourceInfoId,
          unitId: this.orgId,
          eventCode: this.form.eventCode,
          approvalDeptId: this.form.approvalDeptId
        };
      }

      const res = await listPageEmergencyDaily(parmas);
      this.table.tableData = res.data;
      this.paginationAtrrs.total = res.total;
    },
    handleChange(val, item) {
      getDailyName({ responseId: val, creatorUnit: JSON.parse(sessionStorage.getItem("org")).orgName, today: new Date().toLocaleString() }).then(res => {
        // this.$set(this.$refs.formComponent1.form, "dailyName", `${res.slice(0, -2)}${toChineseNumber(res.substr(-2, 1))}期`)
        this.dailyName = res.dailyName;
        this.sourceInfo = res.sourceInfo;
        this.$set(this.$refs.formComponent1.form, "dailyName", `${res.sourceInfo}${res.dailyName}`);

      });
      selectEmergencyDaily({ responseId: val }).then(res => {

        this.tables.tableData = res.baseContent;
        this.UnitInput.tableData = res.unitInputs;
      });
      getinfo({ id: val }).then(res => {
        getByAreaNameAndTimeCode({ areaName: res.effectRange }).then(data => {
          const option = data.map((item) => {
            return {
              location: item.areaname,
              maxTemperature: item.tmax,
              minTemperature: item.tmin,
              daytime: item.dgdWp12,
              night: item.dgdWp12,
              wind: item.eda10Direct
            };
          });
          this.WeatherForecast.tableData = option;
        });
      });

    },
    handleBtn(item) {
      this[item.id]();
    },
    // 列表
    async list() {
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        state: this.$route.query.state

      };
      const res = await listPageEmergencyDaily(parmas);
      this.table.tableData = res.data;
      this.paginationAtrrs.total = res.total;
    },
    // 保存
    async submitForm() {
      this.$refs.formComponent.isValidate();
      this.$refs.formComponent1.isValidate();
      this.$refs.formComponent2.isValidate();
      const flag = this.$refs.formComponent.flag;
      const flag1 = this.$refs.formComponent1.flag;
      const flag2 = this.$refs.formComponent2.flag;
      if (flag && flag1 && flag2) {
        const parmas = {
          sourceInfoId: this.$refs.formComponent.form.sourceInfoId,
          dailyName: this.dailyName,
          sourceInfo: this.sourceInfo,
          overAll: this.$refs.formComponent1.form.overAll,
          baseContent: this.tables.tableData,
          emergencySituation: this.$refs.formComponent2.form.emergencySituation,
          unitInputs: this.UnitInput.tableData,
          weatherForecast: this.WeatherForecast.tableData,
          creatorUnit: sessionStorage.getItem("dwbmName"),
          creatorId: JSON.parse(sessionStorage.getItem("account")).id,
          creator: JSON.parse(sessionStorage.getItem("account")).realName
          // createTime: this.$refs.formComponent3.form.createTime
        };
        if (this.type === 1) {
          parmas.unitId = JSON.parse(sessionStorage.getItem("org")).id;
          parmas.creatorUnit = sessionStorage.getItem("dwbmName");
          const res = await SaveEmergencyDaily(parmas);
          if (res) {
            this.$message({
              message: "保存成功",
              type: "success"
            });
            this.list();
            this.dialogConfig.isShow = false;
            // this.$router.push({ query: { judgeState: this.$route.query.judgeState } })
          }
        } else if (this.type === 2) {
          parmas.modifierId = JSON.parse(sessionStorage.getItem("account")).id;
          parmas.modifier = JSON.parse(sessionStorage.getItem("account")).realName;
          parmas.unitId = JSON.parse(sessionStorage.getItem("org")).superiorDeptId;
          parmas.creatorUnit = sessionStorage.getItem("dwbmName");
          parmas.unitName = JSON.parse(sessionStorage.getItem("org")).unitName;
          parmas.id = this.fid;
          const res = await submitEmergencyDaily(parmas);
          if (res) {
            this.$message({
              message: "提交成功",
              type: "success"
            });
            this.list();
            this.dialogConfig.isShow = false;
            // this.$router.push({ query: { judgeState: this.$route.query.judgeState } })
          }
        } else {
          parmas.id = this.fid;
          parmas.modifierId = JSON.parse(sessionStorage.getItem("account")).id;
          parmas.unitName = JSON.parse(sessionStorage.getItem("org")).unitName;
          parmas.modifier = JSON.parse(sessionStorage.getItem("account")).realName;
          parmas.unitId = JSON.parse(sessionStorage.getItem("org")).superiorDeptId;
          parmas.creatorUnit = sessionStorage.getItem("dwbmName");
          const res = await UpdByIdEmergencyDaily(parmas);
          if (res) {
            this.$message({
              message: "修改成功",
              type: "success"
            });
            this.list();
            this.dialogConfig.isShow = false;
            // this.$router.push({ query: { judgeState: this.$route.query.judgeState } })
          }
        }
      }

    },
    // 编辑
    HanEdit(id) {
      this.dialogConfig.isShow = true;
      getByIdEmergencyDaily({ id: id.id }).then(res => {
        this.fid = res.id;
        this.type = 0;
        this.WeatherForecast.tableData = res.weatherForecast;
        this.tables.tableData = res.baseContent;
        this.UnitInput.tableData = res.unitInputs;
        this.$set(this.$refs.formComponent.form, "sourceInfoId", res.sourceInfoId);
        this.getListEmergencyDaily();
        selectEmergencyDaily({ responseId: res.sourceInfoId }).then(res => {
          // this.WeatherForecast.tableData = res.weatherForecast;
          this.tables.tableData = res.baseContent;
          this.UnitInput.tableData = res.unitInputs;
        });
        this.$set(this.$refs.formComponent1.form, "overAll", res.overAll);
        this.$set(this.$refs.formComponent1.form, "dailyName", `${res.sourceInfo}${res.dailyName}`);
        this.$set(this.$refs.formComponent2.form, "emergencySituation", res.emergencySituation);
        this.$set(this.$refs.formComponent3.form, "creator", res.creator);
        this.$set(this.$refs.formComponent3.form, "creatorUnit", res.creatorUnit);
        this.$set(this.$refs.formComponent3.form, "createTime", res.createTime);
      });
    },
    //
    // 列表删除
    detailForm(id) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        deleteByIdEmergencyDaily({
          id: id.id
        }).then(data => {
          if (data) {
            this.$message({
              message: "删除成功",
              type: "success"
            });
            this.list();
          }
        });
      }).catch(() => {
        this.$message({
          type: "info",
          message: "已取消删除"
        });
      });
    },
    // 报送
    BSubmit() {
      this.type = 2;
      this.submitForm();
    },
    // 取消
    Qxiao() {
      this.$refs.formComponent.form = this.$refs.formComponent.$options.data().form;
      this.$refs.formComponent1.form = this.$refs.formComponent1.$options.data().form;
      this.$refs.formComponent2.form = this.$refs.formComponent.$options.data().form;
      this.$refs.formComponent3.form = this.$refs.formComponent.$options.data().form;
      this.WeatherForecast.tableData = [];
      this.tables.tableData = [];
      this.UnitInput.tableData = [];
      this.$nextTick(() => {
        this.$refs.formComponent.$refs.formInlines.clearValidate();
        this.$refs.formComponent1.$refs.formInlines.clearValidate();
        this.$refs.formComponent2.$refs.formInlines.clearValidate();
        this.$refs.formComponent3.$refs.formInlines.clearValidate();


      });
      this.dialogConfig.isShow = false;
    },
    // 弹窗关闭图标
    close() {
      this.$refs.formComponent.form = this.$refs.formComponent.$options.data().form;
      this.$refs.formComponent1.form = this.$refs.formComponent1.$options.data().form;
      this.$refs.formComponent2.form = this.$refs.formComponent.$options.data().form;
      this.$refs.formComponent3.form = this.$refs.formComponent.$options.data().form;
      this.WeatherForecast.tableData = [];
      this.tables.tableData = [];
      this.UnitInput.tableData = [];
      this.$nextTick(() => {
        this.$refs.formComponent.$refs.formInlines.clearValidate();
        this.$refs.formComponent1.$refs.formInlines.clearValidate();
        this.$refs.formComponent2.$refs.formInlines.clearValidate();
        this.$refs.formComponent3.$refs.formInlines.clearValidate();
      });
      this.dialogConfig.isShow = false;
    },
    onActionClick(item, index) {
      this[item.id](); // 调用按钮对应方法
    },
    getInputVals() {
      // this.formData.forEach((item) => {
      //   if (item.label === "发布单位及部门") {
      //     getOrgApi({ orgType: "unit" }).then(res => {
      //       console.log(res);
      //       const option = res.map((item) => {
      //         return {
      //           label: item.orgName,
      //           value: item.orgCode
      //         };
      //       });
      //       console.log(item.options);
      //       item.options = option;
      //     });
      //   }
      // }
      // );
    },

    // 获取下拉框数据
    getInputVal() {
      this.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroupEmergency({ groupCode: item.dic }).then(res => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: item.dicCode
              };
            });
            item.options = option;
          });
        }
      });
    },
    // 新增
    dialogVisible() {
      this.dialogConfig.isShow = true;
      this.$nextTick(() => {
        this.$refs.formComponent3.form = this.FilledBy;
      });
      this.getListEmergencyDaily();
      this.type = 1;
    },
    // 多选单选
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // 分页
    handleSizeChange(val) {
      // this.pageNum = ;
      // this.pageSize = ;
      console.log(val, "qq");
      const parmas = {
        pageNum: val["current-page"],
        pageSize: val["page-size"],
        state: this.$route.query.state,
        effectRange: this.form.effectRange,
        dailyName: this.form.dailyName,
        // createTime: this.form.createTime ? this.form.createTime.substring(0, 10) : "",
        createTimeStart: this.form.createTime ? this.form.createTime[0] : "",
        createTimeEnd: this.form.createTime ? this.form.createTime[1] : "",
        responseLvCode: this.form.responseLvCode,
        effectTimeStart: this.form.effectStartTime ? this.form.effectStartTime[0] : "", // 开始时间,
        effectTimeEnd: this.form.effectStartTime ? this.form.effectStartTime[1] : "",
        sourceInfo: this.form.sourceInfoId,
        unitId: this.orgId,
        eventCode: this.form.eventCode,
        approvalDeptId: this.form.approvalDeptId
      };
      this.query(parmas);
    },
    // 详情
    detailList(id) {
      this.$router.push({
        name: "EmergencyDailyReportDetail",
        query: { id: id.id }
      });
    }
  }
};
</script>

<style scoped lang="less">
@import "../../../assets/style/ComponentStyle.less";
@import "../../../assets/style/common.less";
@import "../../../assets/style/ComponentStyle.less";
@import "../../../assets/style/pop-upNotification.less";

:deep(.el-breadcrumb__inner.is-link) {
  font-weight: 100;
  color: #fff;
}

:deep(div::-webkit-scrollbar-thumb) {
  border-radius: 10px;
  box-shadow: inset 0 0 5px #d9d9d9;
  background: #d9d9d9;
}

:deep(div::-webkit-scrollbar-track) {
  border-radius: 0;
  background: transparent;
  border: none;
}

.EmergencyList :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
  color: #3270ff;
}

:deep(.el-table--striped .el-table__body tr.el-table__row--striped.el-table__row--striped.el-table__row--striped td) {
  background-color: #f8f9f8;
  /*隔行变色*/
}

:deep(.el-collapse-item__content .el-table) {
  margin: 15px 0 !important;
}

//鼠标悬浮样式
:deep(tr.hover-row) {

  &,
  &.el-table__row--striped {

    &,
    &.current-row {
      >td.el-table__cell {
        background: none;
      }
    }
  }
}

.EmergencyList {
  height: 97% !important;
}

.box {
  // width: 100%;
  // height: 80vh;
  // padding: 0;
  // margin: 0;
  margin-top: 20px;
  background-color: #fff;
  border-radius: 4px;
  padding: 10px;
  box-sizing: border-box;
}
</style>
